What is the output of the following piece of code? class A(): def disp(self): print("A disp()") class B(A): pass obj = B() obj.disp()

Python - Online Exam Test Papers | Python - MCQs[multiple choice questions and answers ] | Python - Mock Test Papers | Python - Practice Papers | Python - Sample Test Papers |

Question:
What is the output of the following piece of code?

class A():
    def disp(self):
        print("A disp()")
class B(A):
    pass
obj = B()
obj.disp()

1. Invalid syntax for inheritance

2.Error because when object is created, argument must be passed

3.Nothing is printed

4.A disp()

Posted Date:-2022-02-11 13:26:20


More MCQS Questions and answers

Search
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!